package com.hundsun.yr.universal.library.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hundsun.yr.universal.library.R;
import com.hundsun.yr.universal.library.widget.progress.CircularProgressBar;


/**
 * @Title: LoadingMoreFooter.java 
 * @Description: RecycleView加载更多视图
 * @date 2015-11-27 上午10:20:42 
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com 
 * @replace author:
 * @replace date:
 * @version V1.0
 */
public class LoadingMoreFooter extends LinearLayout {

	public TextView mLabLoadMore;
	public CircularProgressBar mProgressBarLoadMore;
	private RelativeLayout mFooterView;
    
	public LoadingMoreFooter(Context context) {
		super(context);
		initView(context);
	}

	/**
	 * @param context
	 * @param attrs
	 */
	public LoadingMoreFooter(Context context, AttributeSet attrs) {
		super(context, attrs);
		initView(context);
	}
	
	LayoutInflater mInflater;
    public void initView(Context context ){
    	setGravity(Gravity.CENTER);
    	setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    	
    	mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    	
    	mFooterView = (RelativeLayout) mInflater.inflate(R.layout.load_more_footer, this, false);
    	mLabLoadMore = (TextView) mFooterView.findViewById(R.id.common_load_more_footer_msg);
    	mProgressBarLoadMore = (CircularProgressBar) mFooterView.findViewById(R.id.common_load_more_footer_progress);
    	
    	addView(mFooterView);
        
    }
    
    /**
     * 设置进度条是否可见
     * @param vis
     */
    public void setProgressBarState(int vis){
    	mProgressBarLoadMore.setVisibility(vis);
    }
    
    
    /**
     * 设置加载文字是否可见
     * @param vis
     */
    public void setLabLoadState(int vis){
    	mLabLoadMore.setVisibility(vis);
    }

}
